#ifndef CLIENTLOGIC_H
#define CLIENTLOGIC_H

#include <QString>
#include <QHostAddress>
#include <QMap>
#include "..\commons\commons.h"

class Server;

class RemoteApplication
{
private:
	QString name;
	Status stat;
	bool present;
public:
	RemoteApplication(QString name, Status stat);
	RemoteApplication();
	void setStatus(Status stat);
	QString getName();
	Status getStatus();
	
	void setPresent(bool);
	bool isPresent();
	
};

class ClientLogic
{
private:
	QString name;
	int id;
	int group;
	quint16 join_port;
	int old;
	QHostAddress clientAddress;
	//altre cose qua
	QMap<QString, RemoteApplication*> *applications;
public:
	ClientLogic(int id, QString name, QHostAddress addr, quint16 join_port, Server *serverRef);
	~ClientLogic();
	QString getName();
	int getId();
	int getOld();
	int getGroupId();
	void resetOld();
	void decreaseOld();
	void setClientAddress(QHostAddress addr);
	QHostAddress getClientAddress();
	quint16 getJoinPort();
	bool addApplication(QString appName, Status stat);
	QMap<QString, RemoteApplication*> getRemoteApplications();
	void purgeNotPresent();
};

#endif